A rod type linear motor as one type of linear motors has a plurality of circular cylindrical coils stacked and a rod inserted into a hole of the stacked coils. The rod has magnetic poles of N poles and S poles arranged therein alternately. When three-phase current having 120-degree different three phases is made to pass through the coils of U, V, W phases and a moving magnetic field is generated moving in the coil axial direction, the rod obtains thrust from the moving magnetic field and moves linearly in synchronization with the speed of the moving magnetic field.
Control of the rod movement needs detection of the position of the rod. Conventionally, there is known, as a sensor for detecting the position of the rod, a magnetic encoder having a magnetic scale and a magnetic sensor (see patent document 1). For example, the magnetic scale having the N poles and S poles arranged alternately is mounted to the side of the coils as stator, and the magnetic sensor for detecting the magnitude of the magnetic field of the magnetic scale is mounted on the side of the rod as mover.
As illustrated in FIG. 33, in the magnetic field 41, a magnetic force line 42 extends from the center of the N pole to the center of the S pole. The magnetic sensor 43 detects the magnitude of the magnetic field generated by the magnetic scale 41. The magnitude of the magnetic field becomes largest as the magnetic sensor gets close to the separation point of the N pole and S pole and becomes smallest as the magnetic sensor gets close to the center of the N pole or S pole. By detecting the magnitude of the magnetic field, it becomes possible to know the position of the magnetic sensor 43 relative to the magnetic scale 41.    [Patent Document 1] Japanese Patent No. 3036274